package com.xn.app.muying.util;

import android.util.Log;

import java.net.URLEncoder;

/**
 * API
 * Created by xinnuo on 2016/9/23.
 */
public class APIMethod {

    /**
     * 蓓儿母婴API
     */
    //api公共部分
    public static final String apiURL = "http://api.beierbaby.com/";//正式
//    public static final String apiURL = "http://atest.beierbaby.com/";//测试
//    public static final String apiURL = "http://chunyu.kozow.com/";//测试


    public static final String DengLu = apiURL + "api/token";
    public static final String HuoQuYanZhengMa = apiURL + "api/securitycode/mobile";
    public static final String YanZheng = apiURL + "api/securitycode/validate";
    public static final String ZhuCe = apiURL + "api/account/register";
    public static final String XiuGaiMiMa = apiURL + "api/account/userinfo/password";
    public static final String WangJiMiMa = apiURL + "api/account/userinfo/forgetpassword/sms";
    public static final String TianJiaXinLv = apiURL + "api/wearabledata/record";
    public static final String HuoQuXinLv = apiURL + "api/wearabledata/userdatum";
    public static final String HuoQuXinLvXiangXi = apiURL + "api/wearabledata/detail";
    public static final String Home_Top = apiURL + "api/cms/list/app_index_slider";
    public static final String Home_KePu = apiURL + "api/cms/articlecategory/page";

    //售后服务页面
    public static final String ShouHou = apiURL + "Content/fuwu.html";
    //购买设备页面
    public static final String GouMia = apiURL + "Content/device.html";
    //微店页面
    public static final String WeiDian = "https://weidian.com/?userid=1220817872&wfr=wechatpo_keywords_shop";
    //微店胎心监测仪页面
    public static final String WeiDianTaiXin = "https://weidian.com/item.html?itemID=2139116546&wfr=wechatpo_keywords_shop";
    //微店体温检测仪页面
    public static final String WeiDianTiWen = "https://weidian.com/item.html?itemID=2139119790";

    //问答页面
    public static String WenDa(String id) {
        return apiURL + "api/cyys/geth5url?userId=" + id;
    }

    //女性检查项
    public static String Home_KePu2(int currentPage, int number) {
        return apiURL + "api/cms/article/page?categorySeoName=WomanInspectionItem&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //男性检查项
    public static String Home_KePu_Man(int currentPage, int number) {

        return apiURL + "api/cms/article/page?categorySeoName=ManInspectionItem&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    public static String Home_KePu3(String id) {
        return apiURL + "api/cms/article/detail/" + id + "";
    }

    public static final String Mine_JiuZhenYiYuan = apiURL + "api/organization/hospital/page";
    public static final String Home_Doctor_Left = apiURL + "api/organization/hospital-with-subdepartments/page";

    public static String Home_DoctorList(String id, int currentPage, int number) {
        return apiURL + "api/organization/subdepartment/doctors?id=" + id + "&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //产检项已做、未做
    public static final String isFinish = apiURL + "api/antenatalcares/user/finish-antentalcare";

    //产检项列表
    public static String ChanjianList(String id) {
        return apiURL + "api/antenatalcares/user/antenatalcare/list?hospitalId=" + id;
    }

    //获取用户信息
    public static final String UserInfo = apiURL + "api/account/userinfo";

    //文章获取
    public static String Home_ToDay(int index, int size) {
        return Home_ToDay(index, size, null);
    }

    //搜索
    public static String Home_ToDay(int index, int size, String searchKey) {
        if (searchKey != null && !searchKey.equals("") && !searchKey.equals("null")) {
            searchKey = URLEncoder.encode(searchKey);
            return apiURL + "api/cms/article/page?pageIndex=" + index + "&pageSize=" + size + "&isMatchUserPregnancy=true&isShowOnIndex=true&searchkey=" + searchKey;
        } else {
            return apiURL + "api/cms/article/page?pageIndex=" + index + "&pageSize=" + size + "&isMatchUserPregnancy=true&isShowOnIndex=true";
        }
    }

    //医生详情
    public static String DoctorInfo(String id) {
        return apiURL + "html/doctordetail/" + id + "";
    }

    //医院列表
    public static String HosptialList(String id, int currentPage, int number) {
        return apiURL + "api/cms/article/page?categorySeoName=Hospital&companyId=" + id + "&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //蓓儿课堂
    public static final String BabyStudy = apiURL + "api/cms/articlecategory/subcategories?seoName=BeierClassroom";

    //蓓儿课堂
    public static final String BabyStudy(String id, int currentPage, int number) {
//        return apiURL + "api/cms/article/page?categoryId=" + id + "&pageIndex=" + currentPage + "&pageSize=" + number;
        return apiURL + "api/cms/article/page?categoryId=" + id + "&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //蓓儿课堂分类页面列表
    public static final String BabyStudyList(String id, int currentPage, int number) {
        return apiURL + "api/cms/article/page?categoryId=" + id + "&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //baby信息提交
    public static final String BabyInfo = apiURL + "api/account/babyinfo";
    public static final String InfoRemind = apiURL + "api/antenatalcares/user/pregnancy-status";
    //个人信息提交
    public static final String PeronalSubmit = apiURL + "api/account/user/identityinfo";


    //健康宣教
    public static final String EducationClassify = apiURL + "api/cms/articlecategory/subcategories?seoName=HealthEducation";

    /**
     * 健康宣教详情页
     *
     * @param id   文章id
     * @param lean true 显示下载链接   false则不显示
     * @return
     */
    public static String EducationDetails(String id, boolean lean) {
        String url = null;
        if (lean) {
            url = apiURL + "html/HealthEducationDetail?id=" + id + "&app=" + lean;
        } else {
            url = apiURL + "html/HealthEducationDetail?id=" + id;
        }
        return url;
    }

    /**
     * 健康宣教详情页
     *
     * @param id 文章id
     * @return
     */
    public static String EducationDetails(String id) {
        return EducationDetails(id, false);
    }

    //健康宣教列表页
    public static String EducationList(String classifyID, int currentPage, int number) {
        return apiURL + "api/cms/article/page?categoryId=" + classifyID + "&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //孕产计算
    public static String YunChanJiSuan(float date) {
        return apiURL + "api/antenatalcares/predeliverydate?lastMenstruationDate=" + date;
    }

    //孕产信息提交
    public static final String YunChan_Sumit = apiURL + "api/account/pregnancy-info";
    //就诊医院
    public static final String JiuZhenHospital_Sumit = apiURL + "api/account/userinfo/antenatalcare-hospital";

    //判断实时监测是否有使用权
    public static String Usufruct(String id) {
        return apiURL + "api/eshop/service/remaincount?serviceType=1&companyId=" + id;
    }

    //购买次数选择
    public static String Buy_Time(int id) {
        return apiURL + "api/eshop/serviceproduct/page?serviceType=" + id;
    }

    //获取远程监测历史列表
    public static String FarMonitorList(String id) {
        return apiURL + "api/eshop/remotemonitorservice/history/page?hospitalId=" + id + "&serviceType=1";
    }

    //获取微信支付参数
    public static final String WXPay = apiURL + "api/eshop/serviceorderbuffer";

    //获取我的订单详情
    public static String OrderDetail(int id) {
        return apiURL + "api/eshop/serviceorder/page?serviceType=" + id;
    }

    //版本号获取
    public static final String UpdataManager = apiURL + "api/application/version/android";

    //预约挂号科室选择
    public static String OrderList(int currentPage, int number) {
        return apiURL + "api/organization/hospital-with-subdepartments/page?pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //预约挂号医生获取
    public static String OrderDoctor(String i) {
        return apiURL + "api/organization/reservation/doctors?departmentId=" + i;
    }

    //预约挂号规则获取
    public static String OrderRule(int i) {
        return apiURL + "api/organization/company/" + i;
    }

    //预约挂号提交预约信息
    public static final String OrderSubmit = apiURL + "api/organization/reservation";

    //我的预约数据
    public static String MyOrder(int currentPage, int number) {
        return apiURL + "api/organization/reservation/page?pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //判断是否可以使用化验单解读功能
    public static final String IfSheet = apiURL + "api/hospital/user/reporterdiscern/isavailable";

    //未完成化验单
    public static String UnfinishSheet(int currentPage, int number) {
        return apiURL + "api/hospital/user/reports?isConfirm=false&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //已完成化验单
    public static final String FinishSheet = apiURL + "api/hospital/user/reportcategories?isConfirm=true";

    //已完成化验单详情列表
    public static final String FinishSheetInfo(String id, int currentPage, int number) {
        return apiURL + "api/hospital/user/reports?categoryId=" + id + "&isConfirm=true&pageIndex=" + currentPage + "&pageSize=" + number;
    }

    //化验单详情
    public static final String SheetInfo(String id) {
        return apiURL + "api/hospital/user/report/" + id;
    }

    //化验单确认
    public static final String FinishSure = apiURL + "api/hospital/user/report/confirmation";

    //报告上传
    public static final String CaneraActivity = apiURL + "api/hospital/reporterdiscern";

    //产检详情
    public static String ChanJianDetail(String nextAntenatalCareId) {
        return apiURL + "api/antenatalcares/user/antentalcare/detail/" + nextAntenatalCareId;
    }

    //热门标签
    public static String Seek() {
        return apiURL + "api/cms/hotsearchword/page?categorySeoName=HealthEducation";
    }

    //查询文章数据
    public static String SearchArticle(String data, int currentPage, int number) {
        return apiURL + "api/cms/article/page?pageIndex=" + currentPage + "&pageSize=" + number + "&title=" + data;
    }

    //历史记录
    public static final String SeekLiShi = apiURL + "api/cms/hotsearchword/page?categorySeoName=HealthEducation";

    //获取就诊人信息
    public static String VisitInfo(String id) {
        return apiURL + "api/hospital/his/userinfo?identityID=" + id;
    }

    //获取就诊人报告信息
    public static String VisitReport(String identityID, String fullName) {
        return apiURL + "api/hospital/his/visits-record?identityID=" + identityID + "&fullName=" + fullName;
    }

    //获取健康档案类别
    public static String HealthRecordsCategory(String id) {
        return apiURL + "api/hospital/lis/testmaster?registerID=" + id;
    }

    //获取健康档案详细页html
    public static String HealthRecordsDetail(String id) {
        return apiURL + "html/TestPage?testMainID=" + id;
    }

    //提交投诉建议
    public static final String setFeedBack = apiURL + "api/advicez/advicez";

    //提交产检提醒
    public static final String setRemind = apiURL + "api/antenatalcares/user/remind-antentalcare";

    //查询文章数据
    public static String getRemindHistory(int currentPage, int number) {
        return apiURL + "api/antenatalcares/user/antentalcareremind/list?pageIndex=" + currentPage + "&pageSize=" + number;
    }

    /**
     * 语音解答API
     */
    //api公共部分
    public static final String daBeiApiURL = "http://dabeiapi.beierbaby.com/";

    //获取首页语音解答
    public static String HomeVoiceSolution(int currentPage, int number) {
        return HomeVoiceSolution(null, null, currentPage, number);
    }

    //获取语音解答
    public static String HomeVoiceSolution(String type, String data, int currentPage, int number) {
        if (type != null && !type.equals("") && !type.equals("null")) {
            return daBeiApiURL + "api/problem/problem/page?" + type + "=" + data + "&pageIndex=" + currentPage + "&pageSize=" + number;
        } else {
            return daBeiApiURL + "api/problem/problem/page?pageIndex=" + currentPage + "&pageSize=" + number;
        }
    }

    //根据id获取语音解答
    public static String getVoiceSolutionID(int id) {
        return daBeiApiURL + "api/problem/problem/" + id;
    }
}